package com.lagou.service.impl;

import com.lagou.dao.TokenDao;
import com.lagou.pojo.Token;
import com.lagou.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Optional;

@Service
@Transactional
public class TokenServiceImpl implements TokenService {

    @Autowired
    private TokenDao tokenDao;

    @Override
    public void save(Token token) {
        tokenDao.save(token);
    }

    @Override
    public Token findOneByEmail(String email) {
        return tokenDao.findByEmail(email);
    }

    @Override
    public Optional findOneByExample(Example example) {
        return tokenDao.findOne(example);
    }

}
